const cloud = require('wx-server-sdk')
cloud.init()
exports.main = async (event, context) => {
  try {
    const { OPENID } = cloud.getWXContext()
    const result = await cloud.openapi.subscribeMessage.send({
        touser: OPENID,
        page: '/pages/index/index',
        data: {
          thing2: {
            value: '抽奖活动001'
          },
          time1: {
            value: '2020-10-10 01:01:01'
          },
          thing3: {
            value: '请进入小程序查询'
          }
        },
        templateId: 'fSIZwt3LJGY5jeCmwacCKRR1d7wAkvBUsZM9qPl9c2o'
      })
    console.log(result)
    return result
  } catch (err) {
    console.log(err)
    return err
  }
}